package model;

import java.util.HashSet;
import java.util.Set;

public class Packet {
	private int sync;
	private int pid;
	private int error;
	private int conf;
	private byte[] payload = new byte[184];

	public int getConf() {
		return conf;
	}
	public void setConf(int conf) {
		this.conf = conf;
	}
	
	public int getPid() {
		return pid;
	}
	public void setPid(int pid) {
		this.pid = pid;
	}
	public int getSync() {
		return sync;
	}
	public void setSync(int i) {
		this.sync = i;
	}
	public int getError() {
		return error;
	}
	public void setError(int error) {
		this.error = error;
	}
	/**
	 * @return the payload
	 */
	public byte[] getPayload() {
		return payload;
	}
	/**
	 * @param payload the payload to set
	 */
	public void setPayload(byte[] payload) {
		this.payload = payload;
	}
	public int adapField() {
		
		return (conf & 0x30) >> 4;
	}
	public int sectionLenght(){
		
		int i = this.payload[0];
		int r = this.payload[i];
		int a = this.payload[i+1];
		
		int o = ((r) & 0x03)  << 8 |  (a & 0x00FF) ;
		return  o;
	}
}
